package org.wyq.myweb.jmx.service.mock;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.wyq.myweb.jmx.beaninfo.IInfoBean;
import org.wyq.myweb.jmx.beaninfo.MemoryInfoBean;
import org.wyq.myweb.jmx.service.IMXBeanService;


@Component("mockMemoryService")
public class MockMemoryBeanService implements IMXBeanService{
	Logger log = Logger.getLogger(this.getClass().getName());
	
	long max = 1024;// 1024mb

	@SuppressWarnings("unchecked")
	@Override
	public <T extends IInfoBean> T getInfoBean() {
		MemoryInfoBean miBean = new MemoryInfoBean();
		long random = Math.round(Math.random() * max);
//		miBean.setUsed(random);
//		miBean.setMax(max);
		return (T) miBean;
	}

}
